package com.derbysoft.lowcostadapter.commons.model;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

@Entity
public class Reservation {
    @Id
    private String ersp;

    private String hotelPassport;

    private String bookingReference;

    private String cancellationReference;

    private Date createTime;

    private Date cancelTime;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reservation", fetch = FetchType.LAZY)
    private List<ReservationLog> reservationLogs = new ArrayList<ReservationLog>();

    public String getErsp() {
        return ersp;
    }

    public void setErsp(String ersp) {
        this.ersp = ersp;
    }

    public String getHotelPassport() {
        return hotelPassport;
    }

    public void setHotelPassport(String hotelPassport) {
        this.hotelPassport = hotelPassport;
    }

    public String getBookingReference() {
        return bookingReference;
    }

    public void setBookingReference(String bookingReference) {
        this.bookingReference = bookingReference;
    }

    public String getCancellationReference() {
        return cancellationReference;
    }

    public void setCancellationReference(String cancellationReference) {
        this.cancellationReference = cancellationReference;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCancelTime() {
        return cancelTime;
    }

    public void setCancelTime(Date cancelTime) {
        this.cancelTime = cancelTime;
    }

    public List<ReservationLog> getReservationLogs() {
        return Collections.unmodifiableList(reservationLogs);
    }

    public void appendLog(ReservationLog reservationLog) {
        reservationLogs.add(reservationLog);
    }
}
